//
//  ZpDetailViewController.m
//  WeiBo_OC
//
//  Created by MacBook Pro on 16/5/25.
//  Copyright © 2016年 MacBook Pro. All rights reserved.
//

#import "ZpDetailViewController.h"
#import "ZpBarButtonItem.h"
@implementation ZpDetailViewController

- (instancetype)init
{
    if (self = [super init]) {
        ZpBarButtonItem *rightItem = [ZpBarButtonItem barButtonItemWithImageName:@"navigationbar_friendsearch" andTitle:nil andTarget:self andSelecor:@selector(pushDetailViewController) andTitleNormalColor:[UIColor darkGrayColor] andTitleHightColor:[UIColor orangeColor]];
        
        ZpBarButtonItem *leftItem = [ZpBarButtonItem barButtonItemWithImageName:@"navigationbar_back_withtext" andTitle:nil andTarget:self andSelecor:@selector(popDetailViewController) andTitleNormalColor:[UIColor darkGrayColor] andTitleHightColor:[UIColor orangeColor]];
        
        self.navigationItem.rightBarButtonItem = rightItem;
        self.navigationItem.leftBarButtonItem = leftItem;
    }
    return self;
}

- (void)viewDidLoad{
    [super viewDidLoad];
    
    self.view.backgroundColor = [UIColor whiteColor];
}

- (void)pushDetailViewController{
    
    ZpDetailViewController *vc = [[ZpDetailViewController alloc] init];
    ZpBarButtonItem *item = (ZpBarButtonItem *)vc.navigationItem.leftBarButtonItem;
    UIButton *btn = (UIButton *)[item valueForKey:@"btn"];
    [btn setTitle:@"返回" forState:UIControlStateNormal];
    [btn sizeToFit];

    [self.navigationController pushViewController:vc animated:YES];
}

- (void)popDetailViewController{
    [self.navigationController popViewControllerAnimated:YES];
}
@end
